package com.aididi.enums;

import lombok.Getter;
import lombok.Setter;

/**
 * @author ：xuzexiang
 * @description：错误类型枚举类
 * @date ： 2021/10/28 15:04
 */
@Getter
public enum  ErrorCode {

    DB_ERROR("9955", "请稍后重试"),
    /********公共********/
    PARAMM_NULL("MQ_001","参数为空"),
    PARAMM_ERR("MQ_002","参数为错误"),
    /********生产者*******/
    /********消费者*******/
    NOT_FOUND_CONSUMESERVICE("MQ_100","根据topic和tag没有找到对应的消费服务"),
    HANDLE_RESULT_NULL("MQ_101","消费方法返回值为空"),
    CONSUME_FAIL("MQ_102","消费失败"),
    DATEVALIDAFAIL("9077","数据校验不通过"),
    MQ_NORSEND("4444","MQ不重发") ;

    private String respCode;
    private String respMsg;

    private ErrorCode(String respCode, String respMsg) {
        this.respCode = respCode;
        this.respMsg = respMsg;
    }

    public static String getRespInfo(String respCode) {
        for (ErrorCode prc : ErrorCode.values()) {
            if (prc.getRespCode().equals(respCode)) {
                return prc.respMsg;
            }
        }
        return null;
    }


}
